package com.boomsecret.juc.collections;

import java.util.concurrent.PriorityBlockingQueue;

/**
 * @author wangjinliang on 2019/1/23.
 */
public class PriorityBlockingQueueDemo {
    public static void main(String[] args) {
        PriorityBlockingQueue<String> linkedBlockingQueue = new PriorityBlockingQueue<>();

        linkedBlockingQueue.add("cc");
        linkedBlockingQueue.add("bb");
        linkedBlockingQueue.add("aa");

        for (String value : linkedBlockingQueue) {
            System.out.println(value);
        }
        System.out.println("------------");

        System.out.println(linkedBlockingQueue.poll());
        System.out.println(linkedBlockingQueue.poll());
        System.out.println(linkedBlockingQueue.poll());
        System.out.println("------------");
        System.out.println("main end");
    }
}
